package com.bacon.gmall.web.controller;

import com.bacon.gmall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * @author： bacon、
 * @version： 1.0
 * @create： 2020-12-24 00:08
 * @description:
 */
@Controller
public class ItemController {

    @Autowired
    private ItemFeignClient itemFeignClientl;

    @GetMapping("/{skuId}.html")
    public String getItem(@PathVariable Long skuId,
                          Model model){
        Map map = itemFeignClientl.getItem(skuId);
        model.addAllAttributes(map);
        return "item/index";
    }
}
